package org.come.control;

import org.come.Frame.ActivityJframe;
import org.come.action.FromServerAction;
import org.come.bean.*;
import org.come.until.FormsManagement;
import org.come.until.GsonUtil;

import com.tool.role.RoleData;
import org.come.until.UserMessUntil;

public class MiddleControl implements FromServerAction {
	@Override
	public void controlMessFromServer(final String mes, final String type) {
		final Middle middle = (Middle)GsonUtil.getGsonUtil().getgson().fromJson(mes, Middle.class);
		final LoginResult loginResult = RoleData.getRoleData().getLoginResult();
		final PrivateData data = RoleData.getRoleData().getPrivateData();
		loginResult.setTaskDaily(middle.getTaskDaily());
		data.setTaskComplete(middle.getTaskComplete());
		loginResult.setDaypaysum(middle.getDaypaysum());
		loginResult.setDaygetorno(middle.getDaygetorno());
		loginResult.setDayandpayorno(middle.getDayandpayorno());
		loginResult.setVipget(middle.getVipget());
		loginResult.setDayfirstinorno(middle.getDayfirstinorno());
		if (FormsManagement.getInternalForm2(40) != null) {
			if (FormsManagement.getframe(40).isVisible()) {
				ActivityJframe.getActivityJframe().getActivityJpanel().refreshView();
			}

		AutoActiveBaseBean autoActiveBaseBean = UserMessUntil.getAllAutoActive();
		if(autoActiveBaseBean!=null && autoActiveBaseBean.getAllautobase()!=null && autoActiveBaseBean.getAllautobase().size()>0){
			for(AutoActiveBase autoActiveBase:autoActiveBaseBean.getAllautobase()){
				if(autoActiveBase!=null){
					autoActiveBase.setComNum(0);
				}
			}
		}
	}
}
}